package com.bank.conrtoller;

import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.bank.excption.CommonException;
import com.bank.service.TellerService;

@Controller
public class TellerController  extends BaseController{
	
	Logger logger = Logger.getLogger(TellerController.class);
	
	@Autowired
	TellerService tellerService;
	/**
	 * 获取柜员劣币哦
	 * */
	@RequestMapping(value="getTellerList.do", method=RequestMethod.POST)
	public @ResponseBody Map<String,Object>  getTellerList(@RequestBody Map<String,Object> params){
		
		List<Object> value = tellerService.getTellerList(params);
		Integer total = tellerService.getTellerListCount(params);
		this.setMapValue("total", total);
		this.setMapListValue("data", value);
		return this.returnMap();
	}
	
	@RequestMapping(value="updateTellerList.do", method=RequestMethod.POST)
	public @ResponseBody Map<String,Object>  updateTellerList(@RequestBody Map<String,Object> params) throws CommonException{
		logger.debug("hello");
		tellerService.updateTellerInfo(params);
		this.setAndGetSuccess();
		return this.returnMap();
	}
	
	@RequestMapping(value="addTeller.do", method=RequestMethod.POST)
	public @ResponseBody Map<String,Object>  addTeller(@RequestBody Map<String,Object> params) throws CommonException{
		tellerService.addTeller(params);
		this.setAndGetSuccess();
		return this.returnMap();
	}
	
}
